# 生成器函数：斐波那契数列
def fibonacci_generator(n):
    a, b = 0, 1
    for _ in range(n):
        yield a  # 生成当前值
        a, b = b, a + b  # 更新 a 和 b


# 测试
gen = fibonacci_generator(10)

for num in gen:
    print(num)
